
bool isAnagram(char * s, char * t) {
    int sLen = strlen(s);
    int tLen = strlen(t);
    if (sLen != tLen) {
        return false;
    }

    int cmpCount = 0;
    char sCount[26] = {0};
    char tCount[26] = {0};

    for (int i = 0; i < sLen; ++i) {
        sCount[s[i] - 0x61]++;
    }
    for (int i = 0; i < tLen; ++i) {
        tCount[t[i] - 0x61]++;
    }

    for (int i = 0; i < 26; ++i) {
        if (sCount[i] != tCount[i]) {
            return false;
        }

        cmpCount += sCount[i];
        if (cmpCount == sLen) {
            break;
        }
    }

    return true;
}
